package 反射.T4;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class T4 {

    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {

        Class<?> aClass = Class.forName("反射.T4.Student");
        Constructor<?> constructor = aClass.getConstructor(String.class, int.class);
        Object obj = constructor.newInstance("张三", 18);
        System.out.println(((Student)obj).show());

    }
}
